﻿using System;

namespace FpAgain.FP {
  class TreePrint 
  {
    public Print(tree : Tree) : void 
    {
      def toString(tree) 
      {
        match(tree) {
          | Tree.Variable(name) => name
          | Tree.Sin(op)        => $"sin($(toString(op)))"
          | Tree.Sum(a,b)       => $"$(toString(a))+$(toString(b))"
        }
      }
      Console.WriteLine(toString(tree))
    }
  }
}